<?php
require(dirname(__FILE__) .'/check.php');
$skin->CheckIframe();


/* **** 版权所有 ****

 程序开发：网钛科技
 网钛CMS官网：http://otcms.com
 网钛IDC官网：http://idccms.com
 ＱＱ：877873666
 微信：tudougeaini
 邮箱：877873666@qq.com

 **** 版权所有 **** */


//用户检测
$MB->Open('','login',10);


switch($mudi){
	case 'infoSet':
		$menuFileID = 299;
		$MB->IsSecMenuRight('alertBack',$menuFileID,$dataType);
		InfoSet();
		break;

	default:
		die('err');
}

$MB->Close();
$DB->Close();





// 基本设置
function InfoSet(){
	global $DB,$mudi,$menuFileID,$menuTreeID,$dataType,$dataTypeCN;

	$backURL			= OT::PostStr('backURL');
	$prefIsRev			= OT::PostInt('prefIsRev');
	$isBackMoney		= OT::PostInt('isBackMoney');
	$isMoreReg			= OT::PostInt('isMoreReg');

	$hostState3Num		= OT::PostInt('hostState3Num');
	$vpsProState3Num	= OT::PostInt('vpsProState3Num');
	$vpsApiState3Num	= OT::PostInt('vpsApiState3Num');
	$servState3Num		= OT::PostInt('servState3Num');
	$overApiDay			= OT::PostInt('overApiDay');
		if ($overApiDay <= 0){ $overApiDay = 7; }
	$lessApiDay			= OT::PostInt('lessApiDay');
		if ($lessApiDay <= 0){ $lessApiDay = 7; }
	$failMoneyStr		= OT::Post('failMoneyStr');
		if (is_array($failMoneyStr)){ $failMoneyStr = implode(',',$failMoneyStr); }
	$funcStr		= OT::Post('funcStr');
		if (is_array($funcStr)){ $funcStr = implode(',',$funcStr); }

	$rateDayPro			= OT::PostFloat('rateDayPro');
	$rateWeekPro		= OT::PostFloat('rateWeekPro');
	$rateMonthPro		= OT::PostFloat('rateMonthPro');
	$rate3MonthPro		= OT::PostFloat('rate3MonthPro');
	$rate6MonthPro		= OT::PostFloat('rate6MonthPro');
	$rateYearPro		= OT::PostFloat('rateYearPro');
	$rate2YearPro		= OT::PostFloat('rate2YearPro');
	$rate3YearPro		= OT::PostFloat('rate3YearPro');
	$rate4YearPro		= OT::PostFloat('rate4YearPro');
	$rate5YearPro		= OT::PostFloat('rate5YearPro');

	$keytype			= OT::PostInt('keytype');
	$usetype			= OT::PostInt('usetype');
	$isTryBuy			= OT::PostInt('isTryBuy');
	$isHostZhuanzheng	= OT::PostInt('isHostZhuanzheng');
	$isVpsZhuanzheng	= OT::PostInt('isVpsZhuanzheng');

	$domainAnnoun		= OT::PostStr('domainAnnoun');
	$hostAnnoun			= OT::PostStr('hostAnnoun');
	$vpsProAnnoun		= OT::PostStr('vpsProAnnoun');
	$vpsApiAnnoun		= OT::PostStr('vpsApiAnnoun');
	$servAnnoun			= OT::PostStr('servAnnoun');

	$commArea			= OT::Post('commArea');
		if (is_array($commArea)){ $commArea = implode(',',$commArea); }
	$hostKaiRate		= OT::PostFloat('hostKaiRate')/100;
		 if ($hostKaiRate > 0.6){ $hostKaiRate = 0; }
	$hostKaiMax			= OT::PostFloat('hostKaiMax');
	$hostXuRate			= OT::PostFloat('hostXuRate')/100;
		 if ($hostXuRate > 0.6){ $hostXuRate = 0; }
	$hostXuMax			= OT::PostFloat('hostXuMax');
	$hostXuNum			= OT::PostInt('hostXuNum');
	$vpsProKaiRate		= OT::PostFloat('vpsProKaiRate')/100;
		 if ($vpsProKaiRate > 0.6){ $vpsProKaiRate = 0; }
	$vpsProKaiMax		= OT::PostFloat('vpsProKaiMax');
	$vpsProXuRate		= OT::PostFloat('vpsProXuRate')/100;
		 if ($vpsProXuRate > 0.6){ $vpsProXuRate = 0; }
	$vpsProXuMax		= OT::PostFloat('vpsProXuMax');
	$vpsProXuNum		= OT::PostInt('vpsProXuNum');
	$vpsApiKaiRate		= OT::PostFloat('vpsApiKaiRate')/100;
		 if ($vpsApiKaiRate > 0.6){ $vpsApiKaiRate = 0; }
	$vpsApiKaiMax		= OT::PostFloat('vpsApiKaiMax');
	$vpsApiXuRate		= OT::PostFloat('vpsApiXuRate')/100;
		 if ($vpsApiXuRate > 0.6){ $vpsApiXuRate = 0; }
	$vpsApiXuMax		= OT::PostFloat('vpsApiXuMax');
	$vpsApiXuNum		= OT::PostInt('vpsApiXuNum');
	$dialingKaiRate		= OT::PostFloat('dialingKaiRate')/100;
		 if ($dialingKaiRate > 0.6){ $dialingKaiRate = 0; }
	$dialingKaiMax		= OT::PostFloat('dialingKaiMax');
	$dialingXuRate		= OT::PostFloat('dialingXuRate')/100;
		 if ($dialingXuRate > 0.6){ $dialingXuRate = 0; }
	$dialingXuMax		= OT::PostFloat('dialingXuMax');
	$dialingXuNum		= OT::PostInt('dialingXuNum');
	$pptpKaiRate		= OT::PostFloat('pptpKaiRate')/100;
		 if ($pptpKaiRate > 0.6){ $pptpKaiRate = 0; }
	$pptpKaiMax		= OT::PostFloat('pptpKaiMax');
	$pptpXuRate		= OT::PostFloat('pptpXuRate')/100;
		 if ($pptpXuRate > 0.6){ $pptpXuRate = 0; }
	$pptpXuMax		= OT::PostFloat('pptpXuMax');
	$pptpXuNum		= OT::PostInt('pptpXuNum');
	$servKaiRate		= OT::PostFloat('servKaiRate')/100;
		 if ($servKaiRate > 0.6){ $servKaiRate = 0; }
	$servKaiMax			= OT::PostFloat('servKaiMax');
	$servXuRate			= OT::PostFloat('servXuRate')/100;
		 if ($servXuRate > 0.6){ $servXuRate = 0; }
	$servXuMax			= OT::PostFloat('servXuMax');
	$servXuNum			= OT::PostInt('servXuNum');
	$ipInfoTishi1		= OT::PostStr('ipInfoTishi1');
	$ipInfoTishi2		= OT::PostStr('ipInfoTishi2');
	$siteCheckType		= OT::PostStr('siteCheckType');
	$siteCheckMin		= OT::PostInt('siteCheckMin');
	$siteBadWord		= OT::PostStr('siteBadWord');
	$apiDirUrl			= OT::PostStr('apiDirUrl');
		if (in_array($apiDirUrl,array('http://','https://'))){
			$apiDirUrl = '';
		}elseif ($apiDirUrl != ''){
			if (! Is::HttpUrl($apiDirUrl)){ $apiDirUrl = GetUrl::HttpHead() . $apiDirUrl; }
			if (substr($apiDirUrl,-1) != '/'){ $apiDirUrl .= '/'; }
		}
	$agentDirUrl		= OT::PostStr('agentDirUrl');
		if (in_array($agentDirUrl,array('http://','https://'))){
			$agentDirUrl = '';
		}elseif ($agentDirUrl != ''){
			if (! Is::HttpUrl($agentDirUrl)){ $agentDirUrl = GetUrl::HttpHead() . $agentDirUrl; }
			if (substr($agentDirUrl,-1) != '/'){ $agentDirUrl .= '/'; }
		}
	$jinganApiUrl1		= OT::PostStr('jinganApiUrl1');
		if (in_array($jinganApiUrl1,array('http://','https://'))){
			$jinganApiUrl1 = '';
		}elseif ($jinganApiUrl1 != ''){
			if (! Is::HttpUrl($jinganApiUrl1)){ $jinganApiUrl1 = GetUrl::HttpHead() . $jinganApiUrl1; }
		}
	$jinganApiUrl2		= OT::PostStr('jinganApiUrl2');
		if (in_array($jinganApiUrl2,array('http://','https://'))){
			$jinganApiUrl2 = '';
		}elseif ($jinganApiUrl2 != ''){
			if (! Is::HttpUrl($jinganApiUrl2)){ $jinganApiUrl2 = GetUrl::HttpHead() . $jinganApiUrl2; }
		}

	$record = array();
	$record['VS_prefIsRev']			= $prefIsRev;
	$record['VS_isBackMoney']		= $isBackMoney;
	$record['VS_isMoreReg']			= $isMoreReg;
	$record['VS_hostState3Num']		= $hostState3Num;
	$record['VS_vpsProState3Num']	= $vpsProState3Num;
	$record['VS_vpsApiState3Num']	= $vpsApiState3Num;
	$record['VS_servState3Num']		= $servState3Num;
	$record['VS_overApiDay']		= $overApiDay;
	$record['VS_lessApiDay']		= $lessApiDay;
	$record['VS_failMoneyStr']		= $failMoneyStr;
	$record['VS_funcStr']			= $funcStr;
	$record['VS_domainAnnoun']		= $domainAnnoun;
	$record['VS_hostAnnoun']		= $hostAnnoun;
	$record['VS_vpsProAnnoun']		= $vpsProAnnoun;
	$record['VS_vpsApiAnnoun']		= $vpsApiAnnoun;
	$record['VS_servAnnoun']		= $servAnnoun;
	$record['VS_ipInfoTishi1']		= $ipInfoTishi1;
	$record['VS_ipInfoTishi2']		= $ipInfoTishi2;
	if (AppSiteIpDomain::Jud()){
		$record['VS_siteCheckType']	= $siteCheckType;
		$record['VS_siteCheckMin']	= $siteCheckMin;
		$record['VS_siteBadWord']	= $siteBadWord;
	}
	if (AppIdcApi::Jud()){
		$record['VS_apiDirUrl']		= $apiDirUrl;
	}
	if (AppAgentUsers::Jud()){
		$record['VS_agentDirUrl']	= $agentDirUrl;
	}
	if (AppJingan::Jud()){
		$record['VS_keytype']			= $keytype;
		$record['VS_usetype']			= $usetype;
		$record['VS_isTryBuy']			= $isTryBuy;
		$record['VS_isHostZhuanzheng']	= $isHostZhuanzheng;
		$record['VS_isVpsZhuanzheng']	= $isVpsZhuanzheng;
		$record['VS_jinganApiUrl1']		= $jinganApiUrl1;
		$record['VS_jinganApiUrl2']		= $jinganApiUrl2;
	}
	if (AppXingwai::Jud()){
		$record['VS_rateDayPro']		= $rateDayPro;
		$record['VS_rateWeekPro']		= $rateWeekPro;
		$record['VS_rateMonthPro']		= $rateMonthPro;
		$record['VS_rate3MonthPro']		= $rate3MonthPro;
		$record['VS_rate6MonthPro']		= $rate6MonthPro;
		$record['VS_rateYearPro']		= $rateYearPro;
		$record['VS_rate2YearPro']		= $rate2YearPro;
		$record['VS_rate3YearPro']		= $rate3YearPro;
		$record['VS_rate4YearPro']		= $rate4YearPro;
		$record['VS_rate5YearPro']		= $rate5YearPro;
		$record['VS_rate5YearPro']		= $rate5YearPro;
	}
	if (AppIdcGain::Jud()){
		$record['VS_commArea']			= $commArea;
		$record['VS_hostKaiRate']		= $hostKaiRate;
		$record['VS_hostKaiMax']		= $hostKaiMax;
		$record['VS_hostXuRate']		= $hostXuRate;
		$record['VS_hostXuMax']			= $hostXuMax;
		$record['VS_hostXuNum']			= $hostXuNum;
		$record['VS_vpsProKaiRate']		= $vpsProKaiRate;
		$record['VS_vpsProKaiMax']		= $vpsProKaiMax;
		$record['VS_vpsProXuRate']		= $vpsProXuRate;
		$record['VS_vpsProXuMax']		= $vpsProXuMax;
		$record['VS_vpsProXuNum']		= $vpsProXuNum;
		$record['VS_vpsApiKaiRate']		= $vpsApiKaiRate;
		$record['VS_vpsApiKaiMax']		= $vpsApiKaiMax;
		$record['VS_vpsApiXuRate']		= $vpsApiXuRate;
		$record['VS_vpsApiXuMax']		= $vpsApiXuMax;
		$record['VS_vpsApiXuNum']		= $vpsApiXuNum;
		$record['VS_dialingKaiRate']	= $dialingKaiRate;
		$record['VS_dialingKaiMax']		= $dialingKaiMax;
		$record['VS_dialingXuRate']		= $dialingXuRate;
		$record['VS_dialingXuMax']		= $dialingXuMax;
		$record['VS_dialingXuNum']		= $dialingXuNum;
		$record['VS_pptpKaiRate']		= $pptpKaiRate;
		$record['VS_pptpKaiMax']		= $pptpKaiMax;
		$record['VS_pptpXuRate']		= $pptpXuRate;
		$record['VS_pptpXuMax']			= $pptpXuMax;
		$record['VS_pptpXuNum']			= $pptpXuNum;
		$record['VS_servKaiRate']		= $servKaiRate;
		$record['VS_servKaiMax']		= $servKaiMax;
		$record['VS_servXuRate']		= $servXuRate;
		$record['VS_servXuMax']			= $servXuMax;
		$record['VS_servXuNum']			= $servXuNum;
	}

	$fileResultStr = '';
	$judRes = $DB->UpdateParam('vpsSys',$record,'VS_ID=1');
		if ($judRes){
			$alertRes = '成功';

			$Cache = new Cache();
			$isCacheResult = $Cache->Php('vpsSys');
				if ($isCacheResult){
					$fileResultStr .= '\n../cache/vpsSys.php 生成成功！';
				}else{
					$fileResultStr .= '\n../cache/vpsSys.php 生成失败，请检查该目录或者文件是否有写入/修改权限！';
				}
		}else{
			$alertRes = '失败';
		}


	// 操作日志记录
	Adm::AddLog(array(
		'note'		=> '【'. $dataTypeCN .'】修改'. $alertRes .'！',
		));

	JS::AlertHref('修改'. $alertRes .'\n'. $fileResultStr, $backURL);
}

?>